<?php
  $uri = request_uri();
  if (preg_match('@(thongso|dactinh|baogia|phukien).html@', $uri, $match)) {
    $sub_page = $match[1];
  } else {
    $sub_page = 'phukien';
  }
?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

    <?php if ($sub_page == 'thongso'): ?>
      <div id="product_info">
        <?php require('thongso.php') ?>
      </div>
    <?php elseif ($sub_page == 'baogia'): ?>
      <?php require('baogia.php') ?>
    <?php elseif ($sub_page == 'phukien'): ?>
      <?php require('phukien.php') ?>
    <?php elseif ($sub_page == 'dactinh'): ?>
      <?php require('dactinh.php') ?>
    <?php else: ?>
      <div class="content clear-block">
      <?php print $picture ?>

      <?php if ($page == 0): ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
      <?php endif; ?>

        <?php if ($submitted): ?>
          <span class="submitted"><?php print $submitted; ?></span>
        <?php endif; ?>
        <div id="product_info">
        <?php /*print $content*/ ?>
        <?php $array_keys = array(); ?>
        <?php foreach ($node->content as $key => $field): ?>
          <?php $array_keys[] = $key;?>
        <?php endforeach; ?>
        <?php foreach ($array_keys as $key): ?>
            <?php //print $key; ?>
            <?php if (substr($key, 0, 1) == '#') {continue; }?>
            <div id="product_<?php print $key ?>">
              <?php if(strlen($key) > 5) {
                $tmp = substr($key, 0, 5);
                    //print $tmp;
                    if ($tmp == 'group') {
                      #print $key;
                      print '<div id="group_product_item">'; $group = $node->content[$key];
                      print $group['#children']; print '</div>';
                    }
                    else {
                      #print $key;
                      if (substr($key, 0, 6) == 'field_'){
                        $fieldData = content_fields($key, $node->type);
                        $label = $fieldData['widget']['label'];
                        print_r($label);
                        print $node->content[$key]['#value'];
                      } else {
                        print $node->content[$key]['#value'];
                      }
                    }
                  } else {
                    print $node->content[$key]['#value'];
                  } ?>
            </div>
      <?php endforeach; ?>
      </div> <!-- end #product_info -->
    </div>
   <?php endif; ?>


<?php /*
  <div class="clear-block">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>

    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>
 */ ?>
</div>
